package com.example.demo.http.servlet;

import java.io.IOException;
import java.io.OutputStream;

public class MyResponse {
    private OutputStream out;

    public MyResponse(OutputStream os) {
        this.out = os;
    }

    /**
     * 写出
     * @param s
     * @throws IOException
     */
    public void write(String s) throws IOException {
        StringBuilder sb = new StringBuilder();
        sb.append("HTTP/1.1 200 OK\n")
                .append("Content-type: text/html;\n")
                .append("\n")
                .append(s);
        out.write(sb.toString().getBytes());
    }
}
